home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / gui / pmdev.lha / include / libraries / pm.h
Encoding:
C/C++ Source or Header  |  1998-02-21  |  6.6 KB  |  190 lines

  1. //
  2. //    $VER: pm.h 7.40 (20.2.98)
  3. //
  4. //    Library base, tags and macro definitions
  5. //    for popupmenu.library.
  6. //
  7. //    ©1996-1998 Henrik Isaksson
  8. //    All Rights Reserved.
  9. //
  10.  
  11. #ifndef LIBRARIES_POPUPMENU_H
  12. #define LIBRARIES_POPUPMENU_H
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include <exec/types.h>
  16. #endif
  17.  
  18. #ifndef EXEC_LIBRARIES_H
  19. #include <exec/libraries.h>
  20. #endif
  21.  
  22. #ifndef UTILITY_TAGITEM_H
  23. #include <utility/tagitem.h>
  24. #endif
  25.  
  26. //
  27. // Tags passed to PM_OpenPopupMenuA and PM_FilterIMsgA
  28. //
  29.  
  30. #define PM_Menu            (TAG_USER+4)    // (struct PopupMenu *) Pointer to menulist initialized by MakeMenu()
  31. #define PM_Top            (TAG_USER+12)    // (LONG) Top (Y) position
  32. #define PM_Left            (TAG_USER+13)    // (LONG) Left (X) position
  33. #define PM_Code            (TAG_USER+14)    // (UWORD) Read the documentation.
  34. #define PM_Right        (TAG_USER+15)
  35. #define PM_Bottom        (TAG_USER+16)
  36. #define PM_MinWidth        (TAG_USER+17)
  37. #define PM_MinHeight        (TAG_USER+18)
  38. //#define PM_ForceFont        (TAG_USER+19)
  39. #define PM_PullDown        (TAG_USER+90)    // (BOOL) Make the menu a pulldown menu.
  40. #define PM_MenuHandler        (TAG_USER+91)    // (struct Hook *) Hook that is called for each selected item, after the
  41.                         // menu has been closed. This tag turns on MultiSelect.
  42. #define PM_AutoPullDown        (TAG_USER+92)    // Make an automatic pulldown menu. (PM_FilterIMsg only)
  43. #define PM_LocaleHook        (TAG_USER+93)    // Locale "GetString()" hook. (Not yet implemented)
  44. #define PM_CenterScreen        (TAG_USER+94)    // Center menu on the screen
  45. #define PM_UseLMB        (TAG_USER+95)    // Left mouse button should be used to select an item
  46.                         // (right button selects multiple items)
  47.  
  48. //
  49. // Tags passed to MakeItem
  50. //
  51.  
  52. #define PM_Title        (TAG_USER+20)    // Item title
  53. #define PM_UserData        (TAG_USER+21)    // Anything, returned by OpenPopupMenu when this item is selected
  54. #define PM_ID            (TAG_USER+22)    // ID number, if you want to access this item later
  55. #define PM_Sub            (TAG_USER+23)    // Pointer to submenu list (from MakeMenu)
  56. #define PM_Flags        (TAG_USER+24)    // For internal use
  57. #define PM_NoSelect        (TAG_USER+25)    // Make the item unselectable
  58. #define PM_FillPen        (TAG_USER+26)    // Make the item appear in FILLPEN
  59. #define PM_Checkit        (TAG_USER+27)    // Leave space for a checkmark
  60. #define PM_Checked        (TAG_USER+28)    // Make this item is checked
  61. #define PM_Italic        (TAG_USER+29)    // Italic text
  62. #define PM_Bold            (TAG_USER+30)    // Bold text
  63. #define PM_Underlined        (TAG_USER+31)    // Underlined text
  64. #define PM_TitleBar        (TAG_USER+32)    // Horizontal separator bar
  65. #define PM_WideTitleBar        (TAG_USER+33)    // Same as above, but full width
  66. #define PM_ShadowPen        (TAG_USER+34)    // Draw text in SHADOWPEN
  67. #define PM_ShinePen        (TAG_USER+35)    // Draw text in SHINEPEN
  68. #define PM_Center        (TAG_USER+36)    // Center the text of this item
  69. #define PM_Exclude        (TAG_USER+37)    // Items to unselect (or select) when this gets selected
  70. #define PM_Disabled        (TAG_USER+38)    // Disable an item
  71. #define PM_ImageSelected    (TAG_USER+39)    // Image when selected, PM_Title will be render on top of the image
  72. #define PM_ImageUnselected    (TAG_USER+40)    // Image when unselected
  73. #define PM_IconSelected        (TAG_USER+41)    // Icon when selected
  74. #define PM_IconUnselected    (TAG_USER+42)    // Icon when unselected
  75. //#define PM_Object        (TAG_USER+43)    // BOOPSI object
  76. #define PM_AutoStore        (TAG_USER+44)    // Pointer to BOOL reflecting the current state of the item
  77. #define PM_TextPen        (TAG_USER+45)    // Pen number for text colour of this item, if you want to allocate a pen yourself
  78. #define PM_UserDataString    (TAG_USER+46)    // Allocates memory and copies the string.
  79. #define PM_CommKey        (TAG_USER+47)    // Keyboard shortcut for this item.
  80. #define PM_Shadowed        (TAG_USER+48)    // Gives the text a shadow
  81. #define PM_LocaleTitle        (TAG_USER+49)    // Locale string ID (not yet implemented)
  82. #define PM_ColourBox        (TAG_USER+60)    // Filled rectangle
  83. #define PM_SubConstruct        (TAG_USER+61)    // Constructor hook for submenus
  84. #define PM_SubDestruct        (TAG_USER+62)    // Destructor hook for submenus
  85.  
  86. //
  87. // Tags passed to MakeMenu
  88. //
  89.  
  90. #define PM_Item            (TAG_USER+50)    // Item pointer from MakeItem
  91. #define PM_Dummy        (TAG_USER+51)    // Sometimes very useful
  92.  
  93. //
  94. // Tags passed to MakeIDList
  95. //
  96.  
  97. #define PM_ExcludeID        (TAG_USER+55)    // ID number of menu to deselect when this gets selected
  98. #define PM_IncludeID        (TAG_USER+56)    // ID number of menu to select when this gets selected
  99. #define PM_ReflectID        (TAG_USER+57)    // ID number of menu that should reflect the state of this one
  100. #define PM_InverseID        (TAG_USER+58)    // ID number of menu to inverse reflect the state of this one
  101.  
  102. //
  103. // Macros
  104. //
  105.  
  106. #define PMMenu(t)    PM_MakeMenu(PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, PM_Shadowed, TRUE, PM_Center, TRUE, TAG_DONE),\
  107.             PM_Item, PM_MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  108. #define PMSubMenu(t)    PM_Sub, PM_MakeMenu(PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, TAG_DONE),\
  109.             PM_Item, PM_MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  110. #define PMSimpleSub    PM_Sub, PM_MakeMenu(PM_Dummy, 0
  111. #define PMItem(t)    PM_Item, PM_MakeItem(PM_Title, t
  112. #define PMInfo(t)    PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE
  113. #define PMBar        PM_Item, PM_MakeItem(PM_TitleBar, TRUE
  114. #define PMTitleBar    PMBar
  115. #define PMNarrowBar    PM_Item, PM_MakeItem(PM_TitleBar, TRUE
  116. #define PMNarrowTitleBar    PMNarrowBar
  117. #define PMMenuTitle(t)    PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, PM_Shadowed, TRUE, PM_Center, TRUE, TAG_DONE),\
  118.             PM_Item, PM_MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  119. #define PMExcl        PM_Exclude, PM_MakeIDList(
  120. #define ExID(id)    PM_ExcludeID, id
  121. #define InID(id)    PM_IncludeID, id
  122. #define RefID(id)    PM_ReflectID, id
  123. #define InvID(id)    PM_InverseID, id
  124. #define PMCheckItem(t,id)    PM_Item, PM_MakeItem(PM_Title, t, PM_ID, id, PM_Checkit, TRUE
  125.  
  126. #define PMEnd        TAG_DONE)
  127.  
  128. #ifndef End
  129. #define End        TAG_DONE)
  130. #endif
  131.  
  132. #define PMERR        (-5L)
  133.  
  134. //
  135. // Library base
  136. //
  137.  
  138. #ifndef PM_NOBASE
  139.  
  140. struct PopupMenuBase {
  141.     struct Library        pmb_Library;
  142.     ULONG            pmb_SegList;
  143.     ULONG            pmb_Flags;
  144.     struct Library        *pmb_ExecBase;
  145.     struct Library        *pmb_UtilityBase;
  146.     struct Library        *pmb_IntuitionBase;
  147.     struct Library        *pmb_GfxBase;
  148.     struct Library        *pmb_DOSBase;
  149.     BOOL            pmb_NewPrefs;
  150.     struct Library        *pmb_CxBase;
  151. };
  152.  
  153. #endif
  154.  
  155. #define POPUPMENU_VERSION    7L
  156. #define POPUPMENU_NAME        "popupmenu.library"
  157.  
  158. //
  159. // PopupMenu structure
  160. //
  161. // WARNING!
  162. // This structure may change in future versions.
  163. // Do not rely on anything below "UserData".
  164. //
  165.  
  166. #ifndef PMPRIV_H
  167.  
  168. struct PopupMenu {
  169.     struct PopupMenu    *Next;
  170.     struct PopupMenu    *Sub;
  171.     STRPTR            Title;        // Title
  172.     ULONG            Flags;
  173.     ULONG            ID;        // Item ID
  174.     APTR            UserData;    // UserData
  175.     ULONG            TextPen;
  176.     BOOL            *AutoSetPtr;
  177.     struct PM_IDLst        *Exclude;
  178.     LONG            Top;
  179.     LONG            Height;
  180.     struct Image        *SelImg;
  181.     struct Image        *UnSelImg;
  182.     struct Image        *SelIcon;
  183.     struct Image        *UnSelIcon;
  184.     UBYTE            CommKey;
  185. };
  186.  
  187. #endif
  188.  
  189. #endif
  190.